public class Num2351 {
    char ans;
    public char repeatedCharacter(String s) {
        int[] arr = new int[26];
        char[] chars = s.toCharArray();
        for (char c : chars) {
            int index = c - 'a';
            arr[index]++;
            if (arr[index] == 2) {
                ans = c;
                break;
            }
        }
        return ans;
    }
}
